package com.akk.module.admin.service;

import com.akk.module.admin.entity.AdminRoleMenu;
import com.akk.module.admin.entity.AdminRoleMenuExample;
import com.akk.module.admin.mapper.AdminRoleMenuMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminRoleMenuService {

    @Autowired
    AdminRoleMenuMapper adminRoleMenuMapper;
    @Autowired
    AdminRoleMenuExample adminRoleMenuExample;
    public List<AdminRoleMenu> findMenuByRoleId(String roleId) {
        adminRoleMenuExample.clear();
        adminRoleMenuExample.createCriteria().andRoleIdEqualTo(roleId);
        return adminRoleMenuMapper.selectByExample(adminRoleMenuExample);
    }

    public int deleteBatchByMenuId(String menuId) {
        adminRoleMenuExample.clear();
        adminRoleMenuExample.createCriteria().andMenuIdEqualTo(menuId);
        return adminRoleMenuMapper.deleteByExample(adminRoleMenuExample);
    }

    public int deleteBatchByRoleId(String roleId) {
        adminRoleMenuExample.clear();
        adminRoleMenuExample.createCriteria().andRoleIdEqualTo(roleId);
        return adminRoleMenuMapper.deleteByExample(adminRoleMenuExample);
    }
}
